package com.ruoyi.management.service.impl;

import java.util.List;
import com.ruoyi.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.management.mapper.DrugManageMapper;
import com.ruoyi.management.domain.DrugManage;
import com.ruoyi.management.service.IDrugManageService;

/**
 * 药品Service业务层处理
 * 
 * @author ruoyi
 * @date 2023-05-08
 */
@Service
public class DrugManageServiceImpl implements IDrugManageService 
{
    @Autowired
    private DrugManageMapper drugManageMapper;

    /**
     * 查询药品
     * 
     * @param id 药品ID
     * @return 药品
     */
    @Override
    public DrugManage selectDrugManageById(Long id)
    {
        return drugManageMapper.selectDrugManageById(id);
    }

    /**
     * 查询药品列表
     * 
     * @param drugManage 药品
     * @return 药品
     */
    @Override
    public List<DrugManage> selectDrugManageList(DrugManage drugManage)
    {
        return drugManageMapper.selectDrugManageList(drugManage);
    }

    /**
     * 新增药品
     * 
     * @param drugManage 药品
     * @return 结果
     */
    @Override
    public int insertDrugManage(DrugManage drugManage)
    {
        drugManage.setCreateTime(DateUtils.getNowDate());
        return drugManageMapper.insertDrugManage(drugManage);
    }

    /**
     * 修改药品
     * 
     * @param drugManage 药品
     * @return 结果
     */
    @Override
    public int updateDrugManage(DrugManage drugManage)
    {
        drugManage.setUpdateTime(DateUtils.getNowDate());
        return drugManageMapper.updateDrugManage(drugManage);
    }

    /**
     * 批量删除药品
     * 
     * @param ids 需要删除的药品ID
     * @return 结果
     */
    @Override
    public int deleteDrugManageByIds(Long[] ids)
    {
        return drugManageMapper.deleteDrugManageByIds(ids);
    }

    /**
     * 删除药品信息
     * 
     * @param id 药品ID
     * @return 结果
     */
    @Override
    public int deleteDrugManageById(Long id)
    {
        return drugManageMapper.deleteDrugManageById(id);
    }
}
